<?php
    /**
     * Export all member records in .xls format
     * with the help of the xlsHelper
     */

	//input the export file name
	$xls->setHeader('DSDoanVien_'.date('Y_m_d'));

    $xls->addXmlHeader();
    $xls->setWorkSheetName('DSDoanVien');

    //1st row for columns name
    $xls->openRow();
    $xls->writeString('Mã số');
    $xls->writeString('Họ tên');
    $xls->writeString('Chức vụ');
    $xls->writeString('Chi đoàn');
    $xls->closeRow();

    //rows for data
    foreach ($members as $model):
    	$xls->openRow();
	    $xls->writeString($model['UnionMember']['id']);
	    $xls->writeString($model['UnionMember']['name']);
	    $xls->writeString($model['Position']['position']);
	    $xls->writeString($model['Union']['union_name']);
	    $xls->closeRow();
    endforeach;

    $xls->addXmlFooter();
    exit();
?>
